<script type="text/javascript">
$(function(){
    $("._close").click(function(){
        $(this).parents('.mg2').find('.m1').show();
        $(this).parents('.mg2').find('.m2').hide();
        return false;
    });
    $('._open').click(function(){
        if(!$(this).parents('tr').hasClass('open')){
            $.post('/member/openmail', {'postid':$(this).attr('href').substr(1)}, function(){}, 'json');
        }
        $(this).parents('tr').addClass('open');
        $(this).parents('.mg2').find('.m2').show();
        $(this).parents('.mg2').find('.m1').hide();   
        return false;
    })
});
</script>
<div class="center">
	<div class="home">
    	<div class="home_left">
        	<?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
        </div>
    	<div class="home_right">
        
            <div class="message">
                <div class="messagetop">
                    <h1>我的信箱</h1>
                    <ul>
                        <li<?php echo $this->type==NULL?' class="messageon"':'' ?>><a href="mail">全部消息</a></li>
                        <li<?php echo $this->type==1?' class="messageon"':'' ?>><a href="?type=1">系统消息</a></li>
                        <li<?php echo $this->type==2?' class="messageon"':'' ?>><a href="?type=2">交易通知</a></li>
                    </ul>
                </div>
                <div class="messagelist">
                    <table>
                        <tr>
                            <th class="mg1">状态</th>
                            <th class="mg2">
                            	<span class="mg2l">主题</span>
                                <span>时间</span>
                            </th>
                        </tr>
                        <?php foreach($this->mails['list'] as $item){?>
                        <tr class="<?php echo $item->Status == 1?'open':''?>">
                            <td class="mg1"><i>未读信息</i></td>
                            <td class="mg2">
                            	<div class="info">
                                    <h2><a href="#<?php echo $item->Id ?>" class="_open"><?php echo $item->Title ?></a></h2>
                                    <em><?php echo $item->DateCreated ?></em>
                                </div>
                                <div class="outline m1">
                                    <p><?php echo mb_substr($item->message,0,40,'utf-8') ?>...<a class="_open" href="#<?php echo $item->Id ?>">[详情]</a></p>
                                </div>
                                <div class="m_full m2" style="display:none">
                                    <p><?php echo $item->message ?> <a class="_close" href="#<?php echo $item->Id ?>">[收起]</a></p>
                                </div>
                            </td>
                        </tr>
                        <?php }?>
 
                    </table>
                    <div class="toolbar">
                        <?php echo $this->partial('paging.phtml',array('pages'=>$this->mails))?>
                    </div>
                </div>
			</div>
            
        </div>
	</div>
</div>
